<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
        <script src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
        <script type="text/javascript" src="js/global.js" ></script>
        <link rel="stylesheet" type="text/css" href="css/daka.css"/>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
            	  <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body " style="text-align: left;">
                            <blockquote class="layui-elem-quote">欢迎管理员：
                                <span class="x-red" id="spName"></span>！
                            </blockquote>
                        </div>
                    </div>
               </div>
                           <button class="bubbly-button" type="button" id="dakaya">点击签到</button>
            </div>
        </div>
        </div>
        <script>
        	layui.use(["table","layer"],function(){
        		var $=layui.$;
        		var layer=layui.layer;
        		$("#spName").html(globalData.getCurUName());
        		 $.post(globalData.server+"/QtUserCheck",{
        				"token":globalData.getCurToken(),
        				"uid":globalData.getCurUid(),
        				"time":dateFtt("yyyy-MM-dd", new Date())
        			},function(res){
        				if(res>0){
        					$("#dakaya").css("display","none");
        				}
        			},"json");
        		$("#dakaya").click(function(){
        			var url=globalData.server+"/saveUserCheck";
        			$.post(url,{
        				"userid":globalData.getCurUid(),
        				"username":globalData.getCurUName(),
        				"checkintime":dateFtt("yyyy-MM-dd hh:mm:ss",new Date()),
        				"checkstate":"已签到",
        				"checkouttime":dateFtt("yyyy-MM-dd hh:mm:ss", getSpeicalTime()),
        				"token":globalData.getCurToken()
        			},function(res){
        				if(res>0){
        					layer.msg("签到成功");
        					$("#dakaya").css("display","none");
        				}else{
        					layer.msg("签到未成功，请点击重试");
        				}
        			},"json")
        		})
        		
        		
        		
        		

 var getSpeicalTime = function() {
					var now = new Date;
					now.setHours(now.getHours() + 1);
					return now;
				}
        //格式化时间
				function dateFtt(fmt, date) { //author: meizz 
					var o = {
						"M+": date.getMonth() + 1, //月份 
						"d+": date.getDate(), //日 
						"h+": date.getHours(), //小时 
						"m+": date.getMinutes(), //分 
						"s+": date.getSeconds(), //秒 
						"q+": Math.floor((date.getMonth() + 3) / 3), //季度 
						"S": date.getMilliseconds() //毫秒 
					};
					if(/(y+)/.test(fmt))
						fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
					for(var k in o)
						if(new RegExp("(" + k + ")").test(fmt))
							fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
					return fmt;
				}
        	})
        	
        	
        	
        </script>
        <script>
var animateButton = function(e) {

  e.preventDefault;
  //reset animation
  e.target.classList.remove('animate');
  
  e.target.classList.add('animate');
  setTimeout(function(){
    e.target.classList.remove('animate');
  },700);
};

var classname = document.getElementsByClassName("bubbly-button");

for (var i = 0; i < classname.length; i++) {
  classname[i].addEventListener('click', animateButton, false);
}
</script>
    </body>
</html>